import { HttpException, ValidationError, ValidationPipe } from "@nestjs/common"

export default class Validate extends ValidationPipe {
  protected flattenValidationErrors(validationErrors: ValidationError[]):string[] {

 
     const errors = {}
  validationErrors.forEach((error) => {

    errors[error.property] = Object.values(error.constraints as any)[0]
    throw new HttpException({code:400,message:errors}, 400)
  })
    return []
  }
}